<?php
//=======================================
//###################################
// Kayako Web Solutions
//
// Source Copyright 2001-2004 Kayako Infotech Ltd.
// Unauthorized reproduction is not allowed
// License Number: $%LICENSE%$
// $Author: vshoor $ ($Date: 2007/02/13 06:47:44 $)
// $RCSfile: upgrade.php,v $ : $Revision: 1.4 $ 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//###################################
//=======================================

if (!defined("INSWIFT")) {
	trigger_error("Unable to process $PHP_SELF", E_USER_ERROR);
}

// Delete Bug Fix
if (in_array(MODULE_TICKETS, $registeredmodules))
{
		$_SWIFT["query"]["drop"]["ticketfollowup"] = "DROP TABLE IF EXISTS `". TABLE_PREFIX ."ticketfollowup`;";

		$_SWIFT["query"]["create"]["ticketfollowup"] = "CREATE TABLE ". TABLE_PREFIX ."ticketfollowup (
																		ticketfollowupid INT UNSIGNED NOT NULL AUTO_INCREMENT,
																		dateline INT UNSIGNED NOT NULL DEFAULT '0',
																		execdateline INT UNSIGNED NOT NULL DEFAULT '0',
																		ticketid INT UNSIGNED NOT NULL DEFAULT '0',
																		staffid INT UNSIGNED NOT NULL DEFAULT '0',
																		ownerstaffid INT NOT NULL DEFAULT '0',
																		departmentid INT NOT NULL DEFAULT '0',
																		ticketstatusid INT NOT NULL DEFAULT '0',
																		priorityid INT NOT NULL DEFAULT '0',
																		duedateline INT NOT NULL DEFAULT '0',
																		markasoverdue SMALLINT(3) NOT NULL DEFAULT '0',
																		timeworked INT NOT NULL DEFAULT '0',
																		donote SMALLINT(1) UNSIGNED NOT NULL DEFAULT '0',
																		notetype SMALLINT(1) UNSIGNED NOT NULL DEFAULT '0',
																		ticketnotes MEDIUMTEXT,
																		doreply SMALLINT(1) UNSIGNED NOT NULL DEFAULT '0',
																		replycontents MEDIUMTEXT,
																		doforward SMALLINT(1) UNSIGNED NOT NULL DEFAULT '0',
																		forwardemailto VARCHAR(255) NOT NULL DEFAULT '',
																		forwardcontents MEDIUMTEXT,
																		PRIMARY KEY (ticketfollowupid),
																		KEY ticketfollowup1 (ticketid),
																		KEY ticketfollowup2 (execdateline)
																	);";
		$_SWIFT["query"]["insert"]["cron"][] = "INSERT INTO `". TABLE_PREFIX ."cron` (`nextrun`, `lastrun`, `chour`, `cminute`, `cday`, `module`, `action`, `autorun`, `name`) VALUES ('". time() ."', '". time() ."', '0', '10', '0', 'tickets', 'cronfollowup', '1', 'ticketfollowup');";
}



upgrade_updateVersion("3.02.00");
?>